
import numpy as np
from PIL import ImageGrab
import cv2
import time

BOX=(0,0,400,400)
 
#左上角坐标和右下角坐标
#调整box的值即可改变截取区域
 
while True:
    image = ImageGrab.grab(bbox=BOX)
    image.save("./static/screen.jpg")
    time.sleep(0.2)

    # screen=np.array(ImageGrab.grab(bbox=BOX))
    # cv2.imshow("window",cv2.cvtColor(screen,cv2.COLOR_BGR2RGB))
    # if cv2.waitKey(25) & 0xFF ==ord("q"):
    #     cv2.destroyAllWindows()
    #     break
#  image = ImageGrab.grab(bbox=BOX)
#     image.save("1.jpg")
